settings pass = "oobeSystem "
component name = "Microsoft-Windows-Shell-Setup "
<Display>
<ColorDepth>16</ColorDepth>
<HorizontalResolution>1024</HorizontalResolution>
<RefreshRate>60</RefreshRate>
<VerticalResolution>768</VerticalResolution>
</Display>
for example ^
don't forget to update the dp with the new version of your unattend.xml file after making any changes,
you can verify the settings after deployment by reading the zticonfigure.log file
if you can't figure this out i can post an unattend.xml file for you to do just that, let me know
cheers
Hope this helps.
Does anyone know of a way to set the screen resolution during an OSD task sequence to the "recommended" setting for Windows 7? What I mean is if you go into the screen resolution control panel applet you will see one resolution in there with "(recommended)" next to it. It would be nice to programatically set that during OSD deployment versus using answer files.
I have not used this in SCCM but I don't see why it wouldn't work. I have had this script for a while and couldn't find the qres.exe commandline tool but I am sure you could easily find it in some dark corner of the internet. If it needed to be adjusted to meet some additional requirements I would be willing to give you some assistance.
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("localhost")
For Each strComputer In arrComputers
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_DisplayConfiguration", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
If objItem.PelsWidth <= 800 then
set oShell = CreateObject("WScript.Shell")
oShell.run"qres.exe /x 1024 /y 768"
end if
If objItem.BitsPerPixel < 32 then
set oShell = CreateObject("WScript.Shell")
oShell.run"qres.exe /c:32"
end if
next
Mike Niccum
- Marked as answer by Eric Zhang CHN Monday, January 25, 2010 6:56 AM
Does anyone know of a way to set the screen resolution during an OSD task sequence to the "recommended" setting for Windows 7? What I mean is if you go into the screen resolution control panel applet you will see one resolution in there with "(recommended)" next to it. It would be nice to programatically set that during OSD deployment versus using answer files.
I have not used this in SCCM but I don't see why it wouldn't work. I have had this script for a while and couldn't find the qres.exe commandline tool but I am sure you could easily find it in some dark corner of the internet. If it needed to be adjusted to meet some additional requirements I would be willing to give you some assistance.
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("localhost")
For Each strComputer In arrComputers
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_DisplayConfiguration", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
If objItem.PelsWidth <= 800 then
set oShell = CreateObject("WScript.Shell")
oShell.run"qres.exe /x 1024 /y 768"
end if
If objItem.BitsPerPixel < 32 then
set oShell = CreateObject("WScript.Shell")
oShell.run"qres.exe /c:32"
end if
next
Mike Niccum
- Marked as answer by Eric Zhang CHN Monday, January 25, 2010 6:56 AM
- Proposed as answer by Josh Heffner Thursday, August 19, 2010 8:26 PM
- Proposed as answer by Josh Heffner Thursday, August 19, 2010 8:26 PM
What if you have different sized monitors all over the school? Even some laptops are different resolutions.
Would it work on non-HP computers as well?
matambanadzo,
Did you find an answer to this? I'm coming across the same issue!!
Hi Alex,
No, no-one has provided a solution for me.
I ended up creating a task sequence for each different monitor size we have in the school. Then when it comes to imaging, we choose the task sequence that is the correct monitor size for the computer.
In the task sequences we have an application that applies the correct resolution (http://www.naughter.com/qres.html) at the end of the sequence
So the application command looks something like this ... resswitch.exe 1366 768 32 0
Instructions are included in the zip download from the site above.
You really shouldn't need to have seperate task sequences for each device. First make sure you do not have driver conflicts by injecting only the INF files for the monitor attached to the system (see http://www.deployvista.com/Blog/JohanArwidmark/tabid/78/EntryID/132/language/en-US/Default.aspx for details, you would use scenario 3). Also note that some monitors don't always detect properly in winPE, so you may have to choose the "Install all drivers from the profile" option. Once you have verified that the right INF file is being injected for the right device, (check ztidrivers.log and pnpenum.xml) and it's still not working, verify that the unattend.xml is not setting it for you. Use Windows System Image manager to edit the answer file to have the colordepth, refreshrate and resolution set to 1 (you can leave DPI blank). These setting are under 7 oobesystem\...shell setup\display.
I have tried this under MDT2010 update 1 under a plethora of IBM thinkpads and Dells
- Proposed as answer by Jim_B Friday, August 19, 2011 2:33 PM
You really shouldn't need to have seperate task sequences for each device. First make sure you do not have driver conflicts by injecting only the INF files for the monitor attached to the system (see http://www.deployvista.com/Blog/JohanArwidmark/tabid/78/EntryID/132/language/en-US/Default.aspx for details, you would use scenario 3). Also note that some monitors don't always detect properly in winPE, so you may have to choose the "Install all drivers from the profile" option. Once you have verified that the right INF file is being injected for the right device, (check ztidrivers.log and pnpenum.xml) and it's still not working, verify that the unattend.xml is not setting it for you. Use Windows System Image manager to edit the answer file to have the colordepth, refreshrate and resolution set to 1 (you can leave DPI blank). These setting are under 7 oobesystem\...shell setup\display.
I have tried this under MDT2010 update 1 under a plethora of IBM thinkpads and Dells
- Proposed as answer by Jim_B Friday, August 19, 2011 2:33 PM
No need to run a script to change the recommended resolution, the reason why this is happening is unattend.xml. 1024X768 is hard coded in MDT template unattend.xml. Display value needs to be deleted
- Proposed as answer by TechOrion Wednesday, August 31, 2011 7:27 AM
No need to run a script to change the recommended resolution, the reason why this is happening is unattend.xml. 1024X768 is hard coded in MDT template unattend.xml. Display value needs to be deleted
- Proposed as answer by TechOrion Wednesday, August 31, 2011 7:27 AM
I'm having this issue with Windows 7 SP1 and SCCM's OSD. I'm not using MDT and I do not have a an unattend.xml file or a sysprep.ini file that my process is reading from.
The process was working fine prior to upgrading to SP1 using "Auto Apply Device Drivers". But since upgrading, I can get the right drivers installed, but the resolution is not being set to "recommended". It is being set to generally whatever is the lowest available setting. How can I have my build process always set the resolution to the recommended setting?
Thanks Kubi. But how did you get to that view?
I've looked everywhere in MDT and cannot seem to get that view of the answer file.
EDIT: Never mind. I found out how. Task sequence properties then OS Info tab then Edit Unattend.xml button.
- Edited by matambanadzo Friday, October 07, 2011 3:03 AM
Thanks Kubi. But how did you get to that view?
I've looked everywhere in MDT and cannot seem to get that view of the answer file.
EDIT: Never mind. I found out how. Task sequence properties then OS Info tab then Edit Unattend.xml button.
- Edited by matambanadzo Friday, October 07, 2011 3:03 AM
I don't get the option in the screen shot above when I choose the Properties of a Task Sequence to Edit Unattend.xml. I don't even get an OS Info tab.
I still cannot find a hard-coded display setting in my environment, and the majority (not all) of models are coming up with 800x600. Something tells me it's the driver, but the same display drivers that were applying before SP1 are applying now.
I also opened my WIM file in WAIK and looked at the display settings are they are not configured.
- Edited by William Bowen Friday, October 07, 2011 2:44 PM
I don't get the option in the screen shot above when I choose the Properties of a Task Sequence to Edit Unattend.xml. I don't even get an OS Info tab.
I still cannot find a hard-coded display setting in my environment, and the majority (not all) of models are coming up with 800x600. Something tells me it's the driver, but the same display drivers that were applying before SP1 are applying now.
I also opened my WIM file in WAIK and looked at the display settings are they are not configured.
- Edited by William Bowen Friday, October 07, 2011 2:44 PM
@ William...
The answer Kubi gave is correct. Tried it out the other day and the deployment chose the correct resolution. But it takes a long time to mount the WIM for me to delete the Display option.
I'm not sure why you don't have the OS Info tab.... what version of Windows Server and MDT are you running?
To resolve this I disabled Auto Apply Device Drivers in my SCCM task sequence, and manually created driver packages targeted to each model through a WMI query. My problem after I updated to W7 SP1 was that Auto Apply was applying generic display drivers as opposed to the "recommended" display driver for that model.
As an aside, a great tip I learned with Windows 7 is that after you've installed a needed driver via Device Manager, if you browse to C:\Windows\System32\DriverStore\FileRepository and sort by date, the driver that you just installed should be contained in a folder at the top of the window that will read or look something like this: amdsata.inf_amd64_neutral_67db50590108ebd9. You can copy that folder and it's contents to your SCCM Driver Source share, import it into SCCM from there, and you've now got only the driver(s) you actually need rather than a hodgepodge of best matched drivers that the OS may fault as not being boot critical.
Basic advice: Get away from Auto Apply Device Drivers and build driver packages targeted only to the models you use.
HI,
I'm running sms sp2 r2 with mdt intergrated.
Using unattend.xml vai settings package at deployment time. (not even sure at this point if i need to). I want to set it to use the recommended settings for screen resolution.
How do i edit the xml? Is it safe to just delete the screen resolution settings and it will atuo pick it?
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<UserAccounts>
<AdministratorPassword>
<Value></Value>
<PlainText>true</PlainText>
</AdministratorPassword>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Description>Temp account</Description>
<DisplayName>Temp account</DisplayName>
<Group>Users</Group>
<Name>TempAccount</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<AutoLogon>
<Enabled>true</Enabled>
<Username>Administrator</Username>
<Domain>.</Domain>
<Password>
<Value></Value>
<PlainText>true</PlainText>
</Password>
<LogonCount>999</LogonCount>
</AutoLogon>
<Display>
<ColorDepth>32</ColorDepth>
<HorizontalResolution>1024</HorizontalResolution>
<RefreshRate>60</RefreshRate>
<VerticalResolution>768</VerticalResolution>
</Display>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<CommandLine>cscript.exe C:\MININT\Scripts\LiteTouch.wsf /start</CommandLine>
Yes it should be OK.
If you have MDT then you should be able to do the same method I did (above).
Deleting the Display section should also work in your "unattend.xml" file.
I'm having this issue with Windows 7 SP1 and SCCM's OSD. I'm not using MDT and I do not have a an unattend.xml file or a sysprep.ini file that my process is reading from.
The process was working fine prior to upgrading to SP1 using "Auto Apply Device Drivers". But since upgrading, I can get the right drivers installed, but the resolution is not being set to "recommended". It is being set to generally whatever is the lowest available setting. How can I have my build process always set the resolution to the recommended setting?
I have the same problem in which the correct driver installs, but the resolution will not set. Only when I choose to use an order driver does the resolution get set correctly. I do not have the resolution set in the Unattend.xml file and the setting Kubi posted above about it being hard coded into MDT does not apply either. It simply isn't in the unattend.xml file. Weird thing is this seems to only happen on the HP Elitebook 2730p models. We have other HP and Lenovo models running the same Win 7 x64 image I created with MDT and they all seem to work with no problems.
If I could, I would stay with the older driver, bu I need the newest driver to deal with external monitor detection issues on these tablets, so I guess I just have to fight with the resolution issue and see what I can come up with.
So, for my problem which the HP Elitebook 2730p tablet with the proper resolution not being set after imaging with MDT turned out to be a drive issue. This appears to be a problem with the Mobile Intel 4 Express Chipset. Interl released a new driver a month or two ago and at first, I was having trouble with it, but I downloaded the zip file exreacted the files from it that way instead of running the exe and trying to find where to collect the same files.
One thing I did notice with doing this is that when the files are imported into the model driver foler in MDT, the "Application" files for GfxUi.exe, hkcmd.exe, igfxpers.exe and igfxtray.exe need to be unblocked. You can do this by right clikcing on the file name and going to Properties. At the bottom, you may see the button labeled "Unblock". I ran into this when imaging and the system applying the .2555 version driver would see these files as security issues because they were blocked. Once I unblocked them on the server and reimaged to test, the driver installed and ran beautifully. I even connected an external monitor and got the message saying the optimal screen resolution for the external monitor should be 1024x768. I then did a "Scale to Full Screen" and both screen used the same resolution of the built-in display just as it should. I could disconnect/reconnect the external monitor and the same resolution was used each time. It looks as if this issue is finally solved.
I hope others have some luck with thier issues.
This worked for me (see URL below). I have an HP 2760P tablet that kept defaulting to 1024x768. I added the following two lines to my CustomSettings.ini file, and it fixed the problem.
XResolution=1280 YResolution=800
http://scriptimus.wordpress.com/2011/06/01/mdt-2010-configuring-the-native-screen-resolution/
Shawn
Hi,
It didn't worked for me too, so i ended up writing a powershell script that does the work.
Copy/Paste the following function in a powershell script, and just call it without any parameter. I recommend also that you check if the target computer is not a VM (see the Check-VM function below)
Function Set-ScreenResolution { $pinvokeCode = @" using System; using System.Runtime.InteropServices; namespace Resolution { [StructLayout(LayoutKind.Sequential)] public struct DEVMODE1 { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string dmDeviceName; public short dmSpecVersion; public short dmDriverVersion; public short dmSize; public short dmDriverExtra; public int dmFields; public short dmOrientation; public short dmPaperSize; public short dmPaperLength; public short dmPaperWidth; public short dmScale; public short dmCopies; public short dmDefaultSource; public short dmPrintQuality; public short dmColor; public short dmDuplex; public short dmYResolution; public short dmTTOption; public short dmCollate; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string dmFormName; public short dmLogPixels; public short dmBitsPerPel; public int dmPelsWidth; public int dmPelsHeight; public int dmDisplayFlags; public int dmDisplayFrequency; public int dmICMMethod; public int dmICMIntent; public int dmMediaType; public int dmDitherType; public int dmReserved1; public int dmReserved2; public int dmPanningWidth; public int dmPanningHeight; }; class User_32 { [DllImport("user32.dll")] public static extern int EnumDisplaySettings(string deviceName, int modeNum, ref DEVMODE1 devMode); [DllImport("user32.dll")] public static extern int ChangeDisplaySettings(ref DEVMODE1 devMode, int flags); public const int ENUM_CURRENT_SETTINGS = -1; public const int CDS_UPDATEREGISTRY = 0x01; public const int CDS_TEST = 0x02; public const int DISP_CHANGE_SUCCESSFUL = 0; public const int DISP_CHANGE_RESTART = 1; public const int DISP_CHANGE_FAILED = -1; } public class PrmaryScreenResolution { static public void EnumerateSupportedModes() { DEVMODE1 dm = GetDevMode1(); int modeIndex = 0; int maxWidth = 0; int maxHeight = 0; int maxFreq = 0; while (0 != User_32.EnumDisplaySettings(null, modeIndex, ref dm)) { maxWidth = dm.dmPelsWidth; maxHeight = dm.dmPelsHeight; maxFreq = dm.dmDisplayFrequency; //Console.WriteLine(maxWidth + "*" + maxHeight + "/" + maxFreq); modeIndex++; } Console.WriteLine("Detected Native Screen Resolution : " + maxWidth + "*" + maxHeight + "/" + maxFreq); } static public string ChangeResolution() { DEVMODE1 dm = GetDevMode1(); // Autodetection int modeIndex = 0; int maxWidth = 0; int maxHeight = 0; int maxFreq = 0; while (0 != User_32.EnumDisplaySettings(null, modeIndex, ref dm)) { maxWidth = dm.dmPelsWidth; maxHeight = dm.dmPelsHeight; maxFreq = dm.dmDisplayFrequency; modeIndex++; } Console.WriteLine("Detected screen's native resolution : " + maxWidth + "*" + maxHeight + "/" + maxFreq + "Hz"); if (0 != User_32.EnumDisplaySettings(null, User_32.ENUM_CURRENT_SETTINGS, ref dm)) { //dm.dmPelsWidth = width; //dm.dmPelsHeight = height; //Checking if current resolution and frequency is already to maximum int currentWidth = 0; int currentHeight = 0; int currentFreq = 0; currentWidth = dm.dmPelsWidth; currentHeight = dm.dmPelsHeight; currentFreq = dm.dmDisplayFrequency; if ((currentWidth == maxWidth) && (currentHeight == maxHeight) && (currentFreq == maxFreq)) { return "Current resolution and frequency is already to maximum : no change to be made"; } else { //Setting to the screen's native resolution and frequency dm.dmPelsWidth = maxWidth; dm.dmPelsHeight = maxHeight; dm.dmDisplayFrequency = maxFreq; Console.WriteLine ("Current resolution is " + currentWidth + "*" + currentHeight + "/" + currentFreq + "Hz"); Console.WriteLine ("Setting new resolution to " + maxWidth + "*" + maxHeight + "/" + maxFreq + "Hz"); int iRet = User_32.ChangeDisplaySettings(ref dm, User_32.CDS_TEST); if (iRet == User_32.DISP_CHANGE_FAILED) { return "Unable To Process Your Request. Sorry For This Inconvenience."; } else { iRet = User_32.ChangeDisplaySettings(ref dm, User_32.CDS_UPDATEREGISTRY); switch (iRet) { case User_32.DISP_CHANGE_SUCCESSFUL: { return "Success"; } case User_32.DISP_CHANGE_RESTART: { return "You Need To Reboot For The Change To Happen.\n If You Feel Any Problem After Rebooting Your Machine\nThen Try To Change Resolution In Safe Mode."; } default: { return "Failed To Change The Resolution"; } } } } } else { return "Failed To Change The Resolution."; } } private static DEVMODE1 GetDevMode1() { DEVMODE1 dm = new DEVMODE1(); dm.dmDeviceName = new String(new char[32]); dm.dmFormName = new String(new char[32]); dm.dmSize = (short)Marshal.SizeOf(dm); return dm; } } } "@ Add-Type $pinvokeCode -ErrorAction SilentlyContinue [Resolution.PrmaryScreenResolution]::ChangeResolution() }
Function Check-VM{ Write-Output "Checking if host is a VM" $VM_Count = 0 #Searching for specific VM processes Get-process | Where-Object { ($_.ProcessName -like "VBoxService") -or ($_.ProcessName -like "VBoxTray") -or ($_.ProcessName -like "VMwareTray") -or ($_.ProcessName -like "VMwareUser")} If ($process_list -ne $Null) {$VM_Count += 1} #Checking Bios Informations $Bios_info = Get-WmiObject Win32_BIOS If (($Bios_info.SMBIOSBIOSVersion -like "*virt*") -or ($Bios_info.Version -like "*Vbox*")) {$VM_Count += 1} #Checking Baseboard $Baseboard_info = Get-WmiObject Win32_Baseboard If ($Baseboard_info.Product -like "*440BX Desktop Reference Platform*") {$VM_Count += 1} #Checking HDD $HDD_info = Get-WmiObject Win32_DiskDrive If (($HDD_info.Model -like "*VBOX*") -or ($HDD_info.Model -like "*VMWARE VIRTUAL*")) {$VM_Count += 1} If ($VM_Count -ge 2) { return $true } Else { return $false } }
- Edited by Joris DECOMBE Tuesday, March 19, 2013 1:28 PM
Hi,
It didn't worked for me too, so i ended up writing a powershell script that does the work.
Copy/Paste the following function in a powershell script, and just call it without any parameter. I recommend also that you check if the target computer is not a VM (see the Check-VM function below)
Function Set-ScreenResolution { $pinvokeCode = @" using System; using System.Runtime.InteropServices; namespace Resolution { [StructLayout(LayoutKind.Sequential)] public struct DEVMODE1 { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string dmDeviceName; public short dmSpecVersion; public short dmDriverVersion; public short dmSize; public short dmDriverExtra; public int dmFields; public short dmOrientation; public short dmPaperSize; public short dmPaperLength; public short dmPaperWidth; public short dmScale; public short dmCopies; public short dmDefaultSource; public short dmPrintQuality; public short dmColor; public short dmDuplex; public short dmYResolution; public short dmTTOption; public short dmCollate; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string dmFormName; public short dmLogPixels; public short dmBitsPerPel; public int dmPelsWidth; public int dmPelsHeight; public int dmDisplayFlags; public int dmDisplayFrequency; public int dmICMMethod; public int dmICMIntent; public int dmMediaType; public int dmDitherType; public int dmReserved1; public int dmReserved2; public int dmPanningWidth; public int dmPanningHeight; }; class User_32 { [DllImport("user32.dll")] public static extern int EnumDisplaySettings(string deviceName, int modeNum, ref DEVMODE1 devMode); [DllImport("user32.dll")] public static extern int ChangeDisplaySettings(ref DEVMODE1 devMode, int flags); public const int ENUM_CURRENT_SETTINGS = -1; public const int CDS_UPDATEREGISTRY = 0x01; public const int CDS_TEST = 0x02; public const int DISP_CHANGE_SUCCESSFUL = 0; public const int DISP_CHANGE_RESTART = 1; public const int DISP_CHANGE_FAILED = -1; } public class PrmaryScreenResolution { static public void EnumerateSupportedModes() { DEVMODE1 dm = GetDevMode1(); int modeIndex = 0; int maxWidth = 0; int maxHeight = 0; int maxFreq = 0; while (0 != User_32.EnumDisplaySettings(null, modeIndex, ref dm)) { maxWidth = dm.dmPelsWidth; maxHeight = dm.dmPelsHeight; maxFreq = dm.dmDisplayFrequency; //Console.WriteLine(maxWidth + "*" + maxHeight + "/" + maxFreq); modeIndex++; } Console.WriteLine("Detected Native Screen Resolution : " + maxWidth + "*" + maxHeight + "/" + maxFreq); } static public string ChangeResolution() { DEVMODE1 dm = GetDevMode1(); // Autodetection int modeIndex = 0; int maxWidth = 0; int maxHeight = 0; int maxFreq = 0; while (0 != User_32.EnumDisplaySettings(null, modeIndex, ref dm)) { maxWidth = dm.dmPelsWidth; maxHeight = dm.dmPelsHeight; maxFreq = dm.dmDisplayFrequency; modeIndex++; } Console.WriteLine("Detected screen's native resolution : " + maxWidth + "*" + maxHeight + "/" + maxFreq + "Hz"); if (0 != User_32.EnumDisplaySettings(null, User_32.ENUM_CURRENT_SETTINGS, ref dm)) { //dm.dmPelsWidth = width; //dm.dmPelsHeight = height; //Checking if current resolution and frequency is already to maximum int currentWidth = 0; int currentHeight = 0; int currentFreq = 0; currentWidth = dm.dmPelsWidth; currentHeight = dm.dmPelsHeight; currentFreq = dm.dmDisplayFrequency; if ((currentWidth == maxWidth) && (currentHeight == maxHeight) && (currentFreq == maxFreq)) { return "Current resolution and frequency is already to maximum : no change to be made"; } else { //Setting to the screen's native resolution and frequency dm.dmPelsWidth = maxWidth; dm.dmPelsHeight = maxHeight; dm.dmDisplayFrequency = maxFreq; Console.WriteLine ("Current resolution is " + currentWidth + "*" + currentHeight + "/" + currentFreq + "Hz"); Console.WriteLine ("Setting new resolution to " + maxWidth + "*" + maxHeight + "/" + maxFreq + "Hz"); int iRet = User_32.ChangeDisplaySettings(ref dm, User_32.CDS_TEST); if (iRet == User_32.DISP_CHANGE_FAILED) { return "Unable To Process Your Request. Sorry For This Inconvenience."; } else { iRet = User_32.ChangeDisplaySettings(ref dm, User_32.CDS_UPDATEREGISTRY); switch (iRet) { case User_32.DISP_CHANGE_SUCCESSFUL: { return "Success"; } case User_32.DISP_CHANGE_RESTART: { return "You Need To Reboot For The Change To Happen.\n If You Feel Any Problem After Rebooting Your Machine\nThen Try To Change Resolution In Safe Mode."; } default: { return "Failed To Change The Resolution"; } } } } } else { return "Failed To Change The Resolution."; } } private static DEVMODE1 GetDevMode1() { DEVMODE1 dm = new DEVMODE1(); dm.dmDeviceName = new String(new char[32]); dm.dmFormName = new String(new char[32]); dm.dmSize = (short)Marshal.SizeOf(dm); return dm; } } } "@ Add-Type $pinvokeCode -ErrorAction SilentlyContinue [Resolution.PrmaryScreenResolution]::ChangeResolution() }
Function Check-VM{ Write-Output "Checking if host is a VM" $VM_Count = 0 #Searching for specific VM processes Get-process | Where-Object { ($_.ProcessName -like "VBoxService") -or ($_.ProcessName -like "VBoxTray") -or ($_.ProcessName -like "VMwareTray") -or ($_.ProcessName -like "VMwareUser")} If ($process_list -ne $Null) {$VM_Count += 1} #Checking Bios Informations $Bios_info = Get-WmiObject Win32_BIOS If (($Bios_info.SMBIOSBIOSVersion -like "*virt*") -or ($Bios_info.Version -like "*Vbox*")) {$VM_Count += 1} #Checking Baseboard $Baseboard_info = Get-WmiObject Win32_Baseboard If ($Baseboard_info.Product -like "*440BX Desktop Reference Platform*") {$VM_Count += 1} #Checking HDD $HDD_info = Get-WmiObject Win32_DiskDrive If (($HDD_info.Model -like "*VBOX*") -or ($HDD_info.Model -like "*VMWARE VIRTUAL*")) {$VM_Count += 1} If ($VM_Count -ge 2) { return $true } Else { return $false } }
- Edited by Joris DECOMBE Tuesday, March 19, 2013 1:28 PM
Well that didn't work...
- Edited by Stefano Belluomini Tuesday, May 06, 2014 3:37 AM
Well that didn't work...
- Edited by Stefano Belluomini Tuesday, May 06, 2014 3:37 AM
You can literally just delete the entire section that I bolded, underlined, and put in Italic. At least that's what I did for my x86 image and it worked.HI,
I'm running sms sp2 r2 with mdt intergrated.
Using unattend.xml vai settings package at deployment time. (not even sure at this point if i need to). I want to set it to use the recommended settings for screen resolution.
How do i edit the xml? Is it safe to just delete the screen resolution settings and it will atuo pick it?
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<UserAccounts>
<AdministratorPassword>
<Value></Value>
<PlainText>true</PlainText>
</AdministratorPassword>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Description>Temp account</Description>
<DisplayName>Temp account</DisplayName>
<Group>Users</Group>
<Name>TempAccount</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<AutoLogon>
<Enabled>true</Enabled>
<Username>Administrator</Username>
<Domain>.</Domain>
<Password>
<Value></Value>
<PlainText>true</PlainText>
</Password>
<LogonCount>999</LogonCount>
</AutoLogon>
<Display>
<ColorDepth>32</ColorDepth>
<HorizontalResolution>1024</HorizontalResolution>
<RefreshRate>60</RefreshRate>
<VerticalResolution>768</VerticalResolution>
</Display>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<CommandLine>cscript.exe C:\MININT\Scripts\LiteTouch.wsf /start</CommandLine>